package com.seocoo.worker.order.model;


import com.seocoo.worker.order.req.ReqOrderMaintainDetail;
import com.seocoo.worker.order.req.ReqTakeMaintainOrder;
import com.sfh.lib.mvvm.BaseViewModel;

/**
 * author : Ssp
 * e-mail : 981297079@qq.com
 * date   : 2020/2/2320:32
 * desc   : 安装订单列表
 * version: 1.0
 */
public class OrderMaintainDetailModel extends BaseViewModel {

    public void refreshData(ReqOrderMaintainDetail req) {
        this.execute(true, req, t -> {
            hideLoading();
            if (t.success()) {
                setValue("onQuerySuccess", t.getData());
            } else {
                showDialogToast(t.getMsg());
            }
        });
    }

    /***
     * 维修接单
     * @param maintainId
     */
    public void takeMaintainOrder(String maintainId){
        this.execute(false, new ReqTakeMaintainOrder(maintainId), t -> {
            hideLoading();
            if (t.success()) {
                setValue("onTakeMaintainOrderSuccess",t.getMsg());
            } else {
                showDialogToast(t.getMsg());
            }
        });
    }
}
